<!DOCTYPE html>
<html lang="en">
<head>
    <!--
    @author 赵国杰
    @title 银行不良贷款站全部贷款比重
    -->
    <meta charset="UTF-8">
    <title>银行不良贷款站全部贷款比重</title>
    <!-- 引入Jquery -->
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>

    <!-- 引入Bootstrap -->
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

    <!-- 引入BootStrap-table -->
    <link rel="stylesheet" href="../assets/libs/bootstrap-table-master/dist/bootstrap-table.min.css">
    <script src="../assets/libs/bootstrap-table-master/dist/bootstrap-table.min.js"></script>

    <!-- 引入Bootstrap-paginator -->
    <script src="../assets/libs/bootstrap-paginator-master/build/bootstrap-paginator.min.js"></script>

    <!-- 引入Echarts -->
    <script src="../assets/libs/echarts/echarts.min.js"></script>
    <style>
        .th-inner{
            text-align:center;
        }
    </style>
</head>
<body>
<div class="container">
    <div>
        <ul class="nav nav-tabs">
            <li role="presentation" id="tableTag"><a href="javascript:;" onclick="showTable()">&nbsp;<span class="glyphicon glyphicon-th-large"></span>&nbsp;</a></li>
            <li role="presentation" id="imageTag"><a href="javascript:;" onclick="showImage()">&nbsp;<span class="glyphicon glyphicon-tasks"></span>&nbsp;</a></li>
        </ul>
    </div>

    <div id="tableView">
        <div class="page-header" style="text-align: center;">
            <h3>银行不良贷款站全部贷款比重</h3>
            <br>
            <h4 style="margin-top: -20px;">The total loan proportion of non-performing loans in Banks</h4>
        </div>

        <div style="text-align: right;">单位:&nbsp;%</div>

        <table id="tableData"></table>
    </div>

    <div id="imageView">
        <div class="page-header" style="text-align: center;">
            <h3>银行不良贷款站全部贷款比重柱状图</h3>
            <br>
            <h4 style="margin-top: -20px;">The total loan proportion of non-performing loans in Banks</h4>
        </div>

        <div class="panel" style="margin-top: 1.5em;">
            <!--<div style="text-align: right;">单位:&nbsp;%</div>-->
            <div id="main" style="width: 100%;height:400px;"></div>
        </div>
    </div>

    <div style="color: #959595; margin-top: 1.5em;">*此数据仅展现最近五年，若需全部数据请点击&nbsp;<a href="#" class="btn btn-info btn-xs">
        <span class="glyphicon glyphicon-save"></span> 下载
    </a></div>


    <!-- <div style="text-align: right;"><div id="page"></div></div> -->
</div>
<script>
    $(function(){
        $('#imageView').hide();
        $('#tableTag').attr('class','active');
    })

    function showTable() {
        $('#tableView').show();
        $('#imageView').hide();
        $('#tableTag').attr('class','active');
        $('#imageTag').removeClass('active');
    }

    function showImage() {
        $('#imageView').show();
        $('#tableView').hide();
        $('#imageTag').attr('class','active');
        $('#tableTag').removeClass('active');
    }

    $('#tableData').bootstrapTable({
        striped: true,
        columns: [
            {
                field: 'country',
                title: '国家'
            },
            {
                field: 'year1',
                title: '2000年'
            },
            {
                field: 'year2',
                title: '2005年'
            },
            {
                field: 'year3',
                title: '2010年'
            },
            {
                field: 'year4',
                title: '2013年'
            },
            {
                field: 'year5',
                title: '2014年'
            },
            {
                field: 'year6',
                title: '2015年'
            },
        ],
        data: [
            {
                country: '阿尔巴尼亚',
                year1: '-',
                year2: '2.3',
                year3: '14',
                year4: '23.5',
                year5: '22.8',
                year6: '18.2',
            },
            {
                country: '波黑',
                year1: '21.216',
                year2: '5.276',
                year3: '11.421782175376',
                year4: '15.1198478740683',
                year5: '14.1653123764986',
                year6: '13.6656148912394',
            },
            {
                country: '保加利亚',
                year1: '17.3',
                year2: '2.6',
                year3: '15.4',
                year4: '5.1',
                year5: '-',
                year6: '0.8',
            },
            {
                country: '克罗地亚',
                year1: '-',
                year2: '2.2',
                year3: '11.9177087634194',
                year4: '16.8785208328338',
                year5: '16.7465294214345',
                year6: '-',
            },
            {
                country: '捷克',
                year1: '29.3',
                year2: '3.9',
                year3: '5.38606666822651',
                year4: '5.19728134028281',
                year5: '5.6074178141111',
                year6: '5.63158910169986',
            },
            {
                country: '爱沙尼亚',
                year1: '1',
                year2: '0.2',
                year3: '5.375486401',
                year4: '1.474622315',
                year5: '1.388236099',
                year6: '0.981873691',
            },
            {
                country: '匈牙利',
                year1: '3',
                year2: '2.3',
                year3: '10.0371611',
                year4: '16.82572837',
                year5: '15.62152681',
                year6: '11.6751509',
            },
            {
                country: '拉脱维亚',
                year1: '4.6',
                year2: '0.7',
                year3: '15.93400614',
                year4: '6.407040452',
                year5: '4.597737487',
                year6: '4.644654379',
            },
            {
                country: '立陶宛',
                year1: '11.3',
                year2: '0.6',
                year3: '23.3337719',
                year4: '11.58602904',
                year5: '8.186050131',
                year6: '5.695986975',
            },
            {
                country: '马其顿',
                year1: '34.8',
                year2: '15',
                year3: '9.040709565',
                year4: '10.93956843',
                year5: '10.80591339',
                year6: '10.31444988',
            },
            {
                country: '黑山',
                year1: '-',
                year2: '5.3',
                year3: '20.97',
                year4: '18.38',
                year5: '16.78',
                year6: '13.43',
            },
            {
                country: '波兰',
                year1: '15.5',
                year2: '11',
                year3: '4.912422601',
                year4: '4.977912286',
                year5: '4.823819241',
                year6: '4.341512013',
            },
            {
                country: '罗马尼亚',
                year1: '5.2',
                year2: '1.4',
                year3: '11.8538635',
                year4: '21.87297478',
                year5: '13.93769567',
                year6: '12.33137153',
            },
            {
                country: '塞尔维亚',
                year1: '-',
                year2: '23.8',
                year3: '16.9',
                year4: '21.37',
                year5: '21.54',
                year6: '22.33',
            },
            {
                country: '斯洛伐克',
                year1: '13.7',
                year2: '5',
                year3: '5.836314157',
                year4: '5.139375572',
                year5: '5.34689326',
                year6: '4.34689326',
            },
            {
                country: '斯洛文尼亚',
                year1: '5',
                year2: '1.3',
                year3: '6',
                year4: '5.1',
                year5: '0.9',
                year6: '1',
            }
        ]
    });

    var all = {
        "data": [
            [0,0,0,0,0,0,42.1,0,0,0,0,38.2,0,0,0,6],
            [0,0,2.6,1.7,25.3,0,19.7,0,0,1.6,0,8.6,1.4,2.6,0.1,1.3],
            [0,0,15.4,5.9,98.4,0,68,0,0,18.3,0,27.9,9,9.7,0.1,6,],
            [0,0,5.1,4.1,0,0,95.5,0,0,4.6,1.4,36.4,11.8,7.6,7.4,5.1],
            [0,0,0,0,0,0,6.2,0,0,0,0,11.1,0,0,0,0.9],
            [0,0,0.8,1.8,10.7,0,20.3,0,0,0.4,1.1,14.5,1,0.8,0.3,1]
        ],
        "countrys": ["阿尔巴尼亚","波黑","保加利亚","克罗地亚","捷克","爱沙尼亚","匈牙利","拉脱维亚","立陶宛","马其顿","黑山","波兰","罗马尼亚","塞尔维亚","斯洛伐克","斯洛文尼亚"],
        "years": ["2000年", "2005年", "2010年", "2013年", "2014年", "2015年"]
    };

    var option = {
        timeline: {
            axisType: 'category',
            autoPlay: true,
            playInterval: 5000,
            data: all.years
        },
        options: [{
            tooltip: {
                trigger: 'axis'
            },
            // toolbox: {
            //     show: true,
            //     orient: 'vertical',
            //     x: 'right',
            //     y: 'center',
            //     feature: {
            //         mark: {
            //             show: true
            //         },
            //         dataView: {
            //             show: true,
            //             readOnly: false
            //         },
            //         magicType: {
            //             show: true,
            //             type: ['line', 'bar']
            //         },
            //         restore: {
            //             show: true
            //         },
            //         saveAsImage: {
            //             show: true
            //         }
            //     }
            // },
            title:{
                subtext:'数据来源'
            },
            calculable: true,
            grid: {
                y: 50,
                y2: 100
            },
            xAxis: [{
                type: 'category',
                axisLabel: {
                    interval: 0
                },
                data: all.countrys
            }],
            yAxis: [{
                type: 'value',
                name: '%'
            }],
            series: [{
                name: '银行不良贷款站全部贷款比重',
                type: 'bar',
                data: all.data[0]
            }]
        },
            {
                series: [{
                    data: all.data[1]
                }]
            },
            {
                series: [{
                    data: all.data[2]
                }]
            },
            {
                series: [{
                    data: all.data[3]
                }]
            },
            {
                series: [{
                    data: all.data[4]
                }]
            },
            {
                series: [{
                    data: all.data[5]
                }]
            }
        ]
    };
    var myChart = echarts.init(document.getElementById('main'));
    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
</script>
</body>
</html>